<?php


namespace App\Services;


use App\Models\Setting;

class SettingService
{
    /**
     * @param $name
     * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object|null
     */
    public function getByName($name){
        return Setting::query()->where('name',$name)->first();
    }

    /**
     * @param $name
     * @param $val
     */
    public function setByName($name,$val){
        Setting::query()->where('name',$name)->update(['val'=>$val]);
    }
}
